home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 May: Tool Chest / Apple_Developer_CD_Series_May_1994_Tool_Chest.iso / Tool Chest / Interfaces / Universal Interfaces / stdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-10  |  2.4 KB  |  143 lines  |  [TEXT/MPS ]

  1. /*
  2.     stdlib.h -- General utilities
  3.  
  4.     Copyright Apple Computer,Inc.    1987, 1990, 1993
  5.     All rights reserved.
  6.  
  7. */
  8.  
  9. #ifndef __STDLIB__
  10. #define __STDLIB__
  11.  
  12. #ifndef __size_t__
  13. #define __size_t__
  14. #ifdef powerc
  15. typedef unsigned long size_t;
  16. #else
  17. typedef unsigned int size_t;
  18. #endif /* powerc */
  19. #endif
  20.  
  21. #ifndef __wchar_t__
  22. #define __wchar_t__
  23. typedef short wchar_t;
  24. #endif
  25.  
  26. #ifdef powerc
  27. #pragma options align=power
  28. #endif
  29. struct div_t {
  30.     int quot;            /* quotient */
  31.     int rem;            /* remainder */
  32. } ;
  33. #ifdef powerc
  34. #pragma options align=reset
  35. #endif
  36. typedef struct div_t div_t;
  37.  
  38. #ifdef powerc
  39. #pragma options align=power
  40. #endif
  41. struct ldiv_t {
  42.     long int quot;        /* quotient */
  43.     long int rem;        /* remainder */
  44. };
  45. #ifdef powerc
  46. #pragma options align=reset
  47. #endif
  48. typedef struct ldiv_t ldiv_t;
  49.  
  50. #ifndef NULL
  51. #define NULL 0
  52. #endif
  53.  
  54. #define EXIT_FAILURE 1
  55. #define EXIT_SUCCESS 0
  56.  
  57. #define RAND_MAX 32767
  58.  
  59. #define MB_CUR_MAX 1
  60.  
  61. #ifdef __cplusplus
  62. extern "C" {
  63. #endif
  64.  
  65. /*
  66.  *    String conversion functions
  67.  */
  68.  
  69. double atof (const char *nptr);
  70. int atoi (const char *nptr);
  71. long int atol (const char *nptr);
  72. double strtod (const char *nptr, char **endptr);
  73. long int strtol (const char *nptr, char **endptr, int base);
  74. unsigned long int strtoul (const char *nptr, char **endptr, int base);
  75.  
  76.  
  77. /*
  78.  *    Pseudo-random sequence generation functions
  79.  */
  80.  
  81. int rand (void);
  82. void srand (unsigned int seed);
  83.  
  84.  
  85. /*
  86.  *    Memory management functions
  87.  */
  88.  
  89. void *calloc (size_t nmemb, size_t size);
  90. void free (void *ptr);
  91. void *malloc (size_t size);
  92. void *realloc (void *ptr, size_t size);
  93.  
  94.  
  95. /*
  96.  *    Communication with the environment
  97.  */
  98.  
  99. void abort (void);
  100. int atexit (void (*func)(void));
  101. void exit (int status);
  102. char *getenv (const char *name);
  103. int system (const char *string);
  104.  
  105.  
  106. /*
  107.  *    Searching and sorting utilities
  108.  */
  109.  
  110. void *bsearch (const void *key, const void *base,
  111.                size_t nmemb, size_t size,
  112.                int (*compar)(const void *, const void *));
  113. void qsort (void *base, size_t nmemb, size_t size,
  114.             int (*compar)(const void *, const void *));
  115.  
  116.  
  117. /*
  118.  *    Integer arithmetic functions
  119.  */
  120.  
  121. int abs (int j);
  122. div_t div (int numer, int denom);
  123. long int labs (long int j);
  124. ldiv_t ldiv (long int numer, long int denom);
  125.  
  126.  
  127. /*
  128.  *    Multibyte functions
  129.  */
  130.  
  131. int mblen (const char *s, size_t n);
  132. int mbtowc (wchar_t *pwc, const char *s, size_t n);
  133. int wctomb (char *s, wchar_t wchar);
  134. size_t mbstowcs (wchar_t *pwcs, const char *s, size_t n);
  135. size_t wcstombs (char *s, const wchar_t *pwcs, size_t n);
  136.  
  137.  
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141.  
  142. #endif
  143.